package com.example.testfragmenttab;

import android.os.Bundle;
import android.app.Activity;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTabHost;
import android.view.Menu;
import android.widget.TabHost;

public class MainActivity extends FragmentActivity {
	
	FragmentTabHost mTabHost;
	
	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		mTabHost = (FragmentTabHost)findViewById(android.R.id.tabhost);
		
		mTabHost.setup(this, getSupportFragmentManager(), R.id.realtabcontent);
		
	
		TabHost.TabSpec tabspec = mTabHost.newTabSpec("spec1");
		tabspec.setIndicator("f1tabl");
		
		mTabHost.addTab(tabspec, FragmentOne.class, null);
		
		tabspec = mTabHost.newTabSpec("spec2");
		tabspec.setIndicator("f1tab2");
		mTabHost.addTab(tabspec, FragmentTwo.class, null);
		
		mTabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() {
			
			@Override
			public void onTabChanged(String tabId) {
				// TODO Auto-generated method stub
				if(tabId.equals("spec1")){
					
				}else if(tabId.equals("spec2")){
					
				}
			}
		});
		
		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_main, menu);
		return true;
	}

}
